home *** CD-ROM | disk | FTP | other *** search
- /*
- * Some Tests.c
- *
- * This program source code and it's compiled version is
- * Copyright (c) 1991 N. Hawthorn.
- * This program source code and it's compiled version IS NOT IN THE
- * PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NH" file for details
- * regarding use of this program source code and it's compiled version.
- *
- *
- * Some examples for you...
- *
- */
-
- #include "MUBBS Module.h"
-
- struct PPP { /* this struct is NOT created here (globally) ! */
- int hahaha; /* this is a test struct to pass some variables to the other */
- int hehe; /* test module */
- }; /* you DONT HAVE TO USE THIS, just pass 0 to the module in P */
- /* and make this a empty struct */
-
- tests(){
-
- char datetime[25], testchars[26];
-
- struct PPP P; /* create the struct here (on the stack) */
- /* we actually MAKE the struct in memory HERE, so that we can */
- /* pass it's location to the other module !!! */
- /* both modules need to know the struct's internal values */
-
- if (!G->online[u]) goto byebye; /* do this check so we can log out if hang up */
- print("C> This is the print() routine, only on the mac screen, module mode is %d.\n",mode[u]);
-
- loop:
- loguser(G->modulename[u]); /* this tells where you are for remote sysop, or writes to log file */
-
- /* you print the following so that the sysop can monitor use on the mac screen */
-
- print("C> Line %d %s, at: %s\n",(u+1),G->username[u],G->modulename[u]);
-
- /* this print is for the Example module only */
-
- print("\nC> This module's name is :%s, the calling module's name was :%s ",G->modulename[u],G->oldmodulename[u]);
- send("]] *** Example1 Module Menu ***]]");
- if (!(cmd1(">> Cmd1, In, Getdatetime, Module, Xmodule, Portsin, Sendtext, Wait, Quit :"))) goto byebye; /* timeout */
- send (G->CR[u]);
- switch (G->input[u]) {
- case 'C':
- if (!(cmd1("]Now waiting for one character :"))) goto byebye; /* timeout */
- send("]The character I got was \"%c\".]",G->input[u]);
- break;
- case 'G':
- getdatetime(datetime); /* gets the date & time */
- send("]You are on line %d at %s PST]", (u+1), datetime);
- break;
- case 'I':
- send("]Using in() to get a character, input it here :");
- if (!G->in()) goto byebye; /* timeout */
- send("]The character I got was \"%c\".]",G->input[u]);
- break;
- case 'M':
- P.hahaha=25;
- P.hehe=56;
- send("]P.hahaha=%d, P.hehe=%d before the call",P.hahaha,P.hehe);
- send("]Now calling another module from this one..]");
- module (3,"example2",&P); /* int mode & module's name & pointer to the joe struct */
- send("]P.hahaha=%d, P.hehe=%d AFTER the call",P.hahaha,P.hehe);
- break;
- case 'X':
- send("]Now calling another module from this one, 0 in the pointer !]");
- module (2,"example2",0L); /* int mode & module's name & a empty pointer (long) */
- break;
- case 'P':
- send("]You can type in up to 24 chars here :");
- portsin(testchars, 24);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- send("]You typed in: \"%s\" ",testchars);
- send(G->CR[u]);
- break;
- case 'S':
- send("]sending \":testtext:test.txt\"]");
- G->okcancel[u]=TRUE;
- G->nocheck[u]=FALSE; /* check for controls */
- G->cancel[u]=FALSE;
- sendtext(":testtext:test.txt"); /* send this file in this folder */
- break;
- case 'W':
- send("]Going to wait for 20 seconds, all other ports will not stop though!]");
- wait(20);
- break;
- case 'Q': /* Quit */
- return;
- break;
- }
- if (!G->online[u]) goto byebye; /* log out */
- goto loop;
-
- byebye:
- G->online[u]=FALSE; /* show we timed out */
- }
-
-
-
-